<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 86176
  Date: 2020/10/9
  Time: 19:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ALL USERS INFORMATION</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index_work.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".deleteA").click(function () {
               if (confirm("确认要删除吗？")){
                   $("form").prop("action",$(this).prop("href"));
                   $("form").submit()
               }
               return false;
            });
        });
    </script>
</head>
<body>
    <table>
        <tr>
            <th colspan="7" style="font-size: 30px">ALL USERS INFORMATION</th>
        </tr>
        <tr>
            <th>USER NUMBER</th>
            <th>USERNAME</th>
            <th>PASSWORD</th>
            <th>USER AGE</th>
            <th>USER SEX</th>
            <th>USER EMAIL</th>
            <th>EDIT USER INFORMATION(<a href="${pageContext.request.contextPath}/toadd">ADD USER</a>)</th>
        </tr>
        <c:forEach items="${requestScope.allUsers}" var="user">
            <tr>
                <td>${pageScope.user.id}</td>
                <td>${pageScope.user.username}</td>
                <td>${pageScope.user.password}</td>
                <td>${pageScope.user.age}</td>
                <td>
                    <c:if test="${pageScope.user.sex==0}">女</c:if>
                    <c:if test="${pageScope.user.sex==1}">男</c:if>
                </td>
                <td>${pageScope.user.email}</td>
                <td>
                    <a class="deleteA" href="${pageContext.request.contextPath}/user/${pageScope.user.id}">DELETE</a>/
                    <a href="${pageContext.request.contextPath}/toUpdate/${pageScope.user.id}">UPDATE</a>
                </td>
            </tr>
        </c:forEach>
    </table>
    <form method="post">
        <input type="hidden" name="_method" value="DELETE">
    </form>
</body>
</html>
